import {Injectable, Injector} from '@angular/core';
import {Constant} from '@core/constant';
import {_HttpClient, SettingsService} from '@delon/theme';
import {MyHttpClient} from '../MyHttpClient';

@Injectable()
export class poListService {
  get cnt(): Constant {
    return this.injector.get(Constant);
  }

  constructor(
    private injector: Injector,
    private http: _HttpClient,
    private myHttp: MyHttpClient,
    public setting: SettingsService,
  ) {
  }

  /**
   * 分页获取商品
   */
  list(): string {
    return `${this.cnt.baseUrl}/rest/sapEkpoController/list/` + this.setting.user.username;
  }
  listtemp(): string {
    return `${this.cnt.baseUrl}/rest/sapEkpoController/listtemp/` + this.setting.user.username;
  }
  /**
   * 获取产品
   * @param id
   */
  getprodetail(id) {
    return this.http.get(`${this.cnt.baseUrl}/rest/sapEkpoController/` + id);
  }
  xiadan(ids,xiadantype) {
    return this.http.get(`${this.cnt.baseUrl}/rest/sapEkpoController/xiadan/` + ids+'?username='+ this.setting.user.username+"&xiadantype="+xiadantype);
  }
  delxiadan(ids) {
    return this.http.get(`${this.cnt.baseUrl}/rest/sapEkpoController/delxiadan/` + ids+'?username='+ this.setting.user.username);
  }
  jisuan(ids) {
    return this.http.get(`${this.cnt.baseUrl}/rest/sapEkpoController/jisuan?id=` + ids+'&username='+ this.setting.user.username );
  }
  /**
   * 修改产品
   * @param product
   */
  editPro(product) {
    return this.http.put(
      `${this.cnt.baseUrl}/rest/sapLfa1Controller/${product.id}`,
      product,
    );
  }


  uploadcarinfo(): string {
    return `${this.cnt.baseUrl}/rest/fxjDhImpController/uploadexcel?username=` + this.setting.user.username;
  }


  getpostasklistall() {

    return `${this.cnt.baseUrl}/rest/posXjtaskController/list/` + this.setting.user.username;


  }

  getposfilelist(id) {
    return this.http.get(`${this.cnt.baseUrl}/rest/posXjtaskController/filelist/` + id);
  }


}
